﻿using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;

namespace LdtJudge.DataEngine.Common
{
    public class JsonHelper
    {
        /// <summary>
        /// 判断字符串是否是正确的json
        /// </summary>
        /// <param name="jsonString">json字符串</param>
        /// <returns>是true 否false</returns>
        public static bool IsRightJson(string jsonString)
        {
            bool res;
            try
            {
                JArray ja = (JArray)JsonConvert.DeserializeObject(jsonString);
                res = true;
            }
            catch
            {
                res = false;
            }
            return res;
        }
    }
}
